﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
using BCNPCObject.DB;
using DbLinq;
using DbLinq.Oracle;
using CMISLibrary.Entities;
using CMISLibrary;

namespace BCNPCObject
{
    public class cls_NPC_BCTTCC_Controller
    {
        #region   Atributes

        private DataSet CMIS_Header = new CMISOutputParameter();
        private DataSet ds = new DataSet();
        private DataTable dt = new DataTable();
        private NPC_BCTTCC info;

        #endregion

        #region   Constructor

        public cls_NPC_BCTTCC_Controller()
        {
            info = new NPC_BCTTCC();
        }
        public cls_NPC_BCTTCC_Controller(NPC_BCTTCC Info)
        {
            this.info = Info;
        }

        #endregion

        #region   Properties

        public NPC_BCTTCC pInfor
        {
            get { return info; }
            set { info = value; }
        }

        #endregion

        #region  DungNT NPC
        public DataSet Get_thang_lviec()
        {
            try
            {
                var sthang = from p in CMIS2.DB.S_THANG_LVIEC
                             select new 
                             { 
                                 p.MA_DVIQLY,
                                 p.PHAN_HE,
                                 p.THANG,
                                 p.NAM
                             };
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                dt = Utility.LINQToDataTable(sthang);
                ds.Tables.Add(dt);
                return ds;
            }
            catch
            {
                return null;

            }
        }
        public IEnumerable<NPC_BCTTCC> Get_BCTTCC(string p_madonvi,Int16 p_thang,Int16 p_nam)
        {
            //DataSet ds = new DataSet();
            //DataTable dt = new DataTable();
            try
            {
                CMIS2.ResetDB();
                var q = from p in CMIS2.DB.NPC_BCTTCC
                        where p.MA_DVIQLY == p_madonvi
                        && p.THANG == p_thang && p.NAM == p_nam
                        orderby p.MA_TRAM
                        select p;    
                return q;
            }
            catch
            {
                CMIS2.ResetDB();
                return null;
            }
        }
        #endregion
    }


}
